package main

import (
	"context"
	"syscall"

	"github.com/hanwen/go-fuse/v2/fs"
	"github.com/hanwen/go-fuse/v2/fuse"
	"k8s.io/client-go/kubernetes"
	"k8s.io/client-go/rest"
)

type KubernetesFS struct {
	fs.Inode
	clientset *kubernetes.Clientset
	config    *rest.Config
	namespace string
	podName   string
	container string
}

func NewKubernetesFS(clientset *kubernetes.Clientset, config *rest.Config, namespace, podName, container string) *KubernetesFS {
	return &KubernetesFS{
		clientset: clientset,
		config:    config,
		namespace: namespace,
		podName:   podName,
		container: container,
	}
}

func (k *KubernetesFS) Getattr(ctx context.Context, f fs.FileHandle, out *fuse.AttrOut) syscall.Errno {
	out.Mode = 0o755
	return 0
}

func (k *KubernetesFS) Root() (fs.InodeEmbedder, error) {
	return &Dir{
		fs:   k,
		path: ".", // Set the initial path to the root
	}, nil
}
